package org.ecpkn.PAGridSim.FastOptimizationWithoutSimulation.LAOVS;

import org.ecpkn.PAGridSim.core.gridsimEntity.paMachine.PAMachine;
import org.ecpkn.PAGridSim.core.tasksCreation.RandomTaskCreator;

public class LAOVS {
	public static int getLAOVSNodeNumber(double workload){
		
		if(PAMachine.COEFFICIENT*2/PAMachine.POWERSTATIQUE<=1){
			return (int)workload+1;
		}
		//TODO:else if
		int startNum=(int)workload+1;
		
		double startFrequency=workload/startNum*RandomTaskCreator.STANDARDRATING;
		double alfa=startFrequency*Math.pow(2*PAMachine.COEFFICIENT/PAMachine.POWERSTATIQUE,1.0/3);
		
		int scalingNum=(int) Math.round(startNum*alfa);
		if(scalingNum==0){
			scalingNum=1;
		}
		return scalingNum;
	}

}
